package userHelp

import myredis "common/redis"

type TblMemberStatus struct {
	Uid                       string `json:"uid" db:"uid" cbor:"uid"`
	Deposit_bonus_stage       int64  `json:"deposit_bonus_stage" db:"deposit_bonus_stage" cbor:"deposit_bonus_stage"`
	App_bonus_status          int64  `json:"app_bonus_status" db:"app_bonus_status" cbor:"app_bonus_status"`
	Proxy_invite_bonus_status int64  `json:"proxy_invite_bonus_status" db:"proxy_invite_bonus_status" cbor:"proxy_invite_bonus_status"`
}

var g_tbl_member_status = "tbl_member_status:"

/*
是否已经领取APP下载
*/
func IsGetAppBonus(Uid string) bool {
	LoadUserToRedis(Uid)
	status := myredis.GetUserFieldInt64(Uid, g_tbl_member_status+"app_bonus_status")
	if status > 0 {
		return true
	} else {
		return false
	}
}

func SetAppBonusStatus(Uid string, status int64) {
	LoadUserToRedis(Uid)
	myredis.SetUserFieldValueByInt64(Uid, g_tbl_member_status+"app_bonus_status", status)
}

func GetDepoistBonusStage(Uid string) int64 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldInt64(Uid, g_tbl_member_status+"deposit_bonus_stage")
}

func SetDepoistBonusStage(Uid string, stage int64) {
	LoadUserToRedis(Uid)
	myredis.SetUserFieldValueByInt64(Uid, g_tbl_member_status+"deposit_bonus_stage", stage)
}

func SetProxyInviteBonusStatus(Uid string, status int64) {
	LoadUserToRedis(Uid)
	myredis.SetUserFieldValueByInt64(Uid, g_tbl_member_status+"proxy_invite_bonus_status", status)
}

func GetProxyInviteBonusStatus(Uid string) int64 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldInt64(Uid, g_tbl_member_status+"proxy_invite_bonus_status")
}
